home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2941 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ecf2.puc.edu!bivey
  2. From: bivey@ecf2.puc.edu (Bruce Ivey)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: random number generator
  5. Date: 25 Jan 1996 03:43:48 GMT
  6. Organization: CRL Dialup Internet Access
  7. Message-ID: <4e6u9k$ntc@nntp.crl.com>
  8. References: <4e5rgd$631@ns.campus.mci.net>
  9. NNTP-Posting-Host: ecf2.puc.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Jack Wilson (wilsojt@occ-uky.campus.mci.net) wrote:
  13. : Hello All!!! I am in need of a true random number generator in C...or 
  14. : C++...I am modifying a program to do a random audit for 2000 items to be 
  15. : audited. I have been looking for a rnd # gen. and haven't had much luck. 
  16. : If anyone out there would have the source and wouldn;t mind sharing it I 
  17. : would be grateful. Please e-mail me at 
  18. : wilsojt@occ-uky.campus.mci.net...thanks in advance...Jack
  19.  
  20. It would help if you said what system/compiler you are running.  If you
  21. are using Borland C/C++, their random() function seems to be quite good, 
  22. as determined by the simple tests (chi square, scattergram pairs, and so
  23. on).  Haven't checked it using anything fancier.
  24.  
  25. Do NOT use rand()--the Borland version has a period of only 232, or some
  26. such!.
  27.  
  28. In general, check Knuth's _Seminumerical Algorithms_ or any of several
  29. books with canned code.
  30.  
  31. Good luck.
  32.  
  33. Bruce
  34.  
  35.